$(() => {
    $(".action .book").click(function () {
        //放号编号// 先上找到最近的li
        let scheduleId = $(this).closest("li").attr("id");

        $.ajax({
            url: ctx + "/client/book",
            method: "post",
            dataType: "json",
            data: {
                scheduleId
            },
            success(resp) {
                if (resp.success) {
                    alert("预约成功");
                }else {
                    alert(resp.error);
                }
            },
            error(resp) {
                if (resp.status === 401) {
                    location.href = ctx + "/client/login";
                }
            }
        });
    });
});